<?php
/**
 * Created by PhpStorm.
 * User: teddy
 * Date: 15-12-28
 * Time: 下午6:35
 */

$jobid = $_GET['jobid'];

/*数据库链接*/
$mysqli = new mysqli('192.168.2.191','root','pwd','APITEST');
/*Sql语句*/
$sql = "SELECT * FROM APITEST.TestResult where jobid = " . $jobid;
/*设置UTF8*/
$mysqli->query("set character set 'utf8'");
$mysqli->query("set names 'utf8'");
/*取数据*/
$results = $mysqli->query($sql);

$data = array();
/*把数据放在Array中*/
while($row = $results->fetch_assoc())
{
    $row['url'] = explode("?", $row['url'])[0];

    array_push($data, $row);
}

/*把返回值输出*/
$json = urldecode(json_encode($data));
echo $json;

/*释放资源*/
$results->free();

/*关闭链接*/
$mysqli->close();